Mega Code Archive

Categories
1) Android
2) ASP.Net
3) ASP.Net Tutorial
4) C
5) C Tutorial
6) C#
7) C# Book
8) C# by API
9) C# Tutorial
10) C++
11) C++ Tutorial
12) Delphi
13) Flash ActionScript
14) Flex
15) Java
16) Java Book
17) Java by API
18) Java Tutorial
19) JavaScript DHTML
20) JavaScript Reference
21) JavaScript Tutorial
22) MSOfficeExcel 2007 Tutorial
23) MSOfficePowerPoint 2007 Tutorial
24) MSOfficeWord 2007 Tutorial
25) MSSQL
26) MSSQL Tutorial
27) MySQL
28) MySQL Tutorial
29) Oracle PLSQL
30) Oracle PLSQL Tutorial
31) Perl
32) Php
33) PostgreSQL
34) Python
35) Python Tutorial
36) Ruby
37) Silverlight
38) VB.Net
39) VB.Net by API
40) VB.Net Tutorial
41) Visual C++ .NET
42) VisualBasic Script
43) XML
44) XML Tutorial
 
Ruby
1) Active Record
2) Array
3) CGI
4) Class
5) Collections
6) Database
7) Date
8) Design Patterns
9) Development
10) File Directory
11) GUI
12) Hash
13) Language Basics
14) Method
15) Network
16) Number
17) Rails
18) Range
19) Reflection
20) Statement
21) String
22) Threads
23) Time
24) Tk
25) Unit Test
26) Windows Platform
27) XML
File Directory
1) # Comparing two files f and g
2) A file handleobject is assigned to f directly
3) A little more platform independent
4) Add class method to File class
5) Are two files identical
6) Assign the file handle to a class or instance variable
7) Backing Up to Versioned Filenames
8) Base name with extension stripped
9) Blksize Returns the native file systems block size
10) Blockdev Returns true if the file is a block device
11) Blocks Returns the number of native file system blocks allocated for this file
12) Call system function to delete a folder
13) Change a delimited file
14) Change directories (using an absolute path), and then store the value of the directory path in a variable
15) Change file mode and then delete it
16) Change file mode to 0644
17) Change mode and use system command to check
18) Change times
19) Changing File Modes and Owner
20) Changing the Permissions on a File
21) Chardev Returns true if the file is a character device
22) Check to see if a dicectory exists
23) Checking If a File Exists
24) Checking to See if a File Exists
25) Checking When a File was Last Used
26) Checking whether two files are identical is easy
27) Close the stream with close
28) Collect the lines together
29) Compare a variable storing a directory path with the current directory
30) Compares File
31) Count bytes
32) Counting Characters
33) Counting Sentences and Paragraphs
34) Create a dir, create a file in it, and delete the file, remove the folder
35) Create a temp file under
36) Create class to wrap File exist and File new method
37) Delete a folder recursively
38) Delete either one file at a time or many at once
39) Delete folder older than a certain time
40) Delete with condition
41) Deleting a directory is similar to deleting a file
42) Deleting and Renaming Files
43) Dev Returns an integer representing the device
44) Dev_major Returns the major part of File
45) Dev_minor Returns the minor part of File
46) Dir entries contains all the entries found in a directory
47) Dir entries returns an array with all the entries within the specified directory Dir foreach provides the same feature, but
48) Dir glob includes file
49) Dir tmpdir provides the path to the temporary directory on the current system
50) Dir with patterns
51) Dir[mydir]
52) Dir[mydirfile]
53) Do you own the file
54) Does a file exist
55) Does our group own the file
56) Each word reading
57) Each_byte is always associated with a block
58) Erase all existing content
59) Executable with executable
60) Executable_real Same as executable, but tests using the real owner of the process
61) Extends File class and add new method
62) File a file starting with certain string
63) File Inquiries
64) File Modes Usable with File new
65) File name matching with flags
66) File new creates a new object of the class File using the method new
67) File open
68) File permissions Use File chmod to set permissions (system dependent)
69) File read 500 bytes
70) File readlines
71) File readlink(filename) Returns the given symbolic link as a string Not available on all platforms
72) File tests for two files
73) File Tests method list
74) File truncate
75) File umask(int) Returns the current umask value for this process
76) File unlink does exactly the same thing as File delete
77) File word counter
78) Find a path
79) Find all the rb files in mydir
80) Find all the regular files and subdirectories in mydir
81) Find files
82) Find find by block
83) Find out if a file has a length of zero (0) with zero
84) Find out if it is a directory with directory
85) Find out what the current directory is with Dir pwd
86) Find out when a file was created, modified, or last accessed with ctime, mtime, and atime, respectively
87) Find patter matching
88) Find the fifth byte
89) Find the MP3s
90) Find the README files
91) Finding and Changing the Current Working Directory
92) Finding the Files
93) Finds all files modified more recently than a certain number of seconds ago
94) Finds all files that are larger than a certain threshold
95) Finds all files that havent been accessed since they were last modified
96) Finds files that were probably left behind by emacs sessions
97) Flock (locking_constant) Locks or unlocks afile according to locking_constant
98) Folder name
99) Get a list of the files and directories within a specific directory using Dir entries
100) Get all contents other than , , and hidden files
101) Get char and unget char
102) Get extension name
103) Get file creation time
104) Get file last accessed time
105) Get file size
106) Get file type
107) Get free disk space under unix with df command
108) Get free disk space under windows with dir command
109) Get its size in bytes with size or size
110) Get stat for your file
111) Get the expaned path through expand_path
112) Get the longest line
113) Get the names of all files in the directory
114) Getting the Size of a File
115) Gid Returns the numeric group ID of the owner
116) Give everyone access to everything
117) Know When Youre at the End of a File
118) If you need a directory, create it with mkdir; later on, delete it with rmdir (or delete, a synonym of rmdir
119) If you want to add extra directories to this $
120) Ino Returns the inode number
121) Inquire about the type of a file with ftype
122) IO modes
123) IO popen(-)
124) Is a file empty
125) Is it a directory or a file
126) Is it block, char or socket or pipe
127) Join file name and folder name together
128) Just the local filename
129) Latin-1 transcoded to UTF-8 in File open
130) Latin-1, transcoded to UTF-8
131) Link a file
132) Listing A Directory
133) Locking a File
134) Lstat
135) Masks for chmod
136) Match any of the given strings
137) Mode Returns an integer representing the permission bits
138) More concise way of getting directory listings is by using Dirs class array method
139) Move a file with fileutils
140) Move file position
141) Nlink Returns the number of hard links to this file
142) Now the Dir object is useless until we call Dir#rewind
143) Open a binary file with rb+
144) Open a file and write string into it
145) Open a file for reading binary data
146) Open a file in a mode where it can be read from and written to at the same time
147) Open a file stream, and then retrieve each line in order with the IO method gets
148) Open a folder with block logics
149) Open a folder with grep as a filter
150) Open a pipe
151) Open a program with a readwrite IO stream and handle data in both directions
152) Open current directory and output its path
153) Open file block
154) Opens text txt for reading and writing, and changes the first character of the first line to X
155) Opens up your text txt file
156) OS independent
157) Output each line in a file and close it
158) Override file open method
159) Paragraph count
160) Parse a mp3 file
161) Parse a mp3 file and returns [track, artist, album, year, comment, genre]
162) Parse line
163) Performing Random Access on Read-Once Input Streams
164) Picking a Random Line from a File
165) Position the file pointer 5 bytes from the end of the file and change the character to an X
166) Pretending a String is a File
167) Print all lines containing the word target
168) Print every fifth character in a file
169) Processing a Binary File
170) Prune under file basename
171) Pull out the first two lines of the example file
172) Push data to string
173) Puts outputs lines of text, perform the writing equivalents of getc and read with putc and write
174) Pwd is an alias for getwd
175) Rdev Returns an integer representing the device type
176) Rdev_major
177) Rdev_minor Returns the minor part of File
178) Read 4 bytes starting at byte 2
179) Read 50 characters
180) Read a binary file by byte
181) Read a text file readlines
182) Read a text file with File read
183) Read an arbitrary number of bytes from a file into a single variable using read
184) Read an IO stream byte by byte with each_byte
185) Read and return the entire file
186) Read file by chunk size
187) Read from byte 6 to end-of-file
188) Read line by line with each
189) Read line from a text file
190) Read lines into an array
191) Read lines one at a time and initialize a hash
192) Read one byte from a binary file
193) Read UTF-8 text
194) Readable_real Returns true if statfile is readable by the real user ID of this process
195) Reading the Contents of a File
196) Readline raises an EOFError when it reaches the end of the file
197) Readlines by
198) Redirecting Standard Input or Output
199) Regex-style character classes
200) Rename a file
201) Replace string in a file
202) Ruby stores the list of directories to search for included files in a special variable called $
203) Save what you read to a file
204) Seek by position
205) Sentence count
206) Set permissions on a new directory (not one that already exists) with mkdir
207) Set position of a file
208) Setgid Returns true if it has the set group id permission bit set
209) Setuid Returns true if it has the set user id permission bit set
210) Showing Line Numbers
211) Single-character wildcards
212) Socket Returns true if the file is a socket
213) Specify absolute paths to create directories under other specific directories
214) Split file and folder name
215) Standard streams
216) Sticky Returns true if it has its sticky bit set
217) Symlink Returns true if the file is a symbolic link
218) Take away the worlds read access
219) Take away the worlds write and execute access
220) Tell me where I am
221) Tempfile can create temporary files for you
222) Test if the file is readable with readable
223) Test what the numeric file descriptor is for your IO stream (to_i also works)
224) Test whether the file exists with exist
225) Testing single files
226) Text file line counter
227) The Different Modes of Opening a File
228) The method syswrite writes the contents of the file
229) The second parameter r defines that youre opening the file for reading
230) The time is returned as a Time object
231) To change directory within a Ruby program, use Dir chdir
232) To create a new IO stream named ios, use the new method
233) To establish when a file was last modified, use File mtime
234) Uid Returns the numeric user ID of the owner of statfile
235) Use code block to insert string to a file
236) Use Dir mkdir to create directories
237) Use Dir tmpdir with File join to create a platform-independent way of creating a temporary file
238) Use each method to loop through a text file
239) Use File expand_path to turn basic filenames into complete paths
240) Use File join to put together a filename using directory names and a final filename
241) Use the gets statement of the class File
242) Use the method sysread to read the contents of a file
243) Using the append mode to create a program that appends a line of text to a file each time its run
244) UTF-8 text
245) With Dirs foreach
246) Writable with writable
247) Writable_real Returns true if it is writable by the real user ID
248) Write characters to an IO stream with putc, and retrieve those characters with getc
249) Write strings to the stream (buffer) with the method, then flush the buffer with flush
250) Write to a string
251) Write UTF-8 text
252) Writing to a Temporary File
253) Writing to Files
254) YAML dump
255) You can also read an entire file into an array, split by lines
256) You can change the owner and group of a file with the chown method
257) You need to specify the full path for the file unless the file is in the current working directory
258) You open up an IO stream with dir
259) Your Position Within a File